package org.jeecg.modules.crm.erp.service.impl;

import org.jeecg.modules.crm.erp.entity.ErpAaOrder;
import org.jeecg.modules.crm.erp.entity.ErpAaOrderProduct;
import org.jeecg.modules.crm.erp.entity.ErpAaOrderAddress;
import org.jeecg.modules.crm.erp.mapper.ErpAaOrderProductMapper;
import org.jeecg.modules.crm.erp.mapper.ErpAaOrderAddressMapper;
import org.jeecg.modules.crm.erp.mapper.ErpAaOrderMapper;
import org.jeecg.modules.crm.erp.service.IErpAaOrderService;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import java.io.Serializable;
import java.util.List;
import java.util.Collection;

/**
 * @Description: 水果订单表
 * @Author: jeecg-boot
 * @Date:   2024-07-31
 * @Version: V1.0
 */
@Service
public class ErpAaOrderServiceImpl extends ServiceImpl<ErpAaOrderMapper, ErpAaOrder> implements IErpAaOrderService {

	@Autowired
	private ErpAaOrderMapper erpAaOrderMapper;
	@Autowired
	private ErpAaOrderProductMapper erpAaOrderProductMapper;
	@Autowired
	private ErpAaOrderAddressMapper erpAaOrderAddressMapper;
	
	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delMain(String id) {
		erpAaOrderProductMapper.deleteByMainId(id);
		erpAaOrderAddressMapper.deleteByMainId(id);
		erpAaOrderMapper.deleteById(id);
	}

	@Override
	@Transactional(rollbackFor = Exception.class)
	public void delBatchMain(Collection<? extends Serializable> idList) {
		for(Serializable id:idList) {
			erpAaOrderProductMapper.deleteByMainId(id.toString());
			erpAaOrderAddressMapper.deleteByMainId(id.toString());
			erpAaOrderMapper.deleteById(id);
		}
	}
	
}
